<template>
    <img :src="captchaImg" alt="" style="width:85px;height: 32px" @click="getCode">
</template>

<script lang="ts" setup>
    import {getCaptcha} from "../http/common";
    import {ref, defineExpose} from 'vue'

    const captchaImg = ref('')
    const captchaKey = ref('')

    const getCode = () => {
        getCaptcha().then(res => {
            const {data} = res;
            captchaImg.value = data.img
            captchaKey.value = data.key
            console.log("captchaKey", captchaKey.value)
        })
    }
    getCode()
    defineExpose({
        captchaKey,
        captchaImg,
        getCode
    })

</script>

<style lang="scss" scoped>

</style>
